#include<unordered_map>
#include<iostream>
#include<vector>
#include<string>
#include<set>
using namespace std;
string str;
unordered_map<char,vector<string>>mp;
set<string>st;
int main(){
    int n,s=0;cin>>n;
    for(int i=0;i<n;i++){
        cin>>str;
        for(int i=0;i<str.length();i++)
            mp[str[i]].push_back(str);
    }
    for(auto val:st)
        for(auto v:val)
            cout<<v<<endl;
    return 0;
} 
